home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / 3_0 / CUTILSLI / UTILITYL / STDGFILE.C < prev    next >
Text File  |  1987-11-10  |  2KB  |  53 lines

  1.     /********************************************
  2.     *    Filename:    StdGFile.c                                                                
  3.     *    Purpose:    Standard Get File Function                                                
  4.     *    Authors:    Robert E. Neville                                                        
  5.     *    Date:        11/10/87                                                        
  6.     *    Functions:    StdGFile().                                                                                        
  7.     *    Version        1.0                                                                            
  8.     *    Copyright:    Hummingbird Graphics                                        
  9.     *********************************************/
  10.  
  11.     #include <MacTypes.h>
  12.     #include <StdFilePkg.h>
  13.  
  14.     /****************************************************************
  15.     *    Function:    StdGFile(fname, vref, nTypes, tList, pt)
  16.     *    Purpose:    Display Standard File Dialog
  17.     *    Passed:        fname    -     Ptr to FileName
  18.     *                vref    -     Ptr to Volume Reference No.
  19.     *                nTypes    -    Number of Types (4 max)
  20.     *                tList    -    Ptr to Type List
  21.     *                pt        -   Point - Top/Left Location
  22.     *    Returned:    TRUE     -     If operation successful
  23.     *                FALSE    -     Cancel Hit
  24.     *****************************************************************/
  25.  
  26.     StdGFile(fName, vRef, nTypes, tList, pt)
  27.     Str255        *fName;                    /* Ptr to fileName */
  28.     short        *vRef;                    /* Ptr to Volume Ref */
  29.     short        nTypes;                    /* Number of Types */
  30.     SFTypeList    *tList;                    /* Ptr to Type List */
  31.     Point        pt;                        /* Where to place the Dialog */
  32.     {
  33.         SFReply        reply;                /* Std Get File Array */    
  34.     
  35.         SFGetFile(                        /* StdFile Dialog */
  36.                     pt,                    /* where */
  37.                   "\p",                    /* No prompt string */
  38.                   0L,                    /* File Filter */
  39.                   nTypes,                /* Number of types */
  40.                   tList,                /* The Types */
  41.                   0L,                    /* Dlghook */
  42.                   &reply);                /* Store reply */
  43.         if(reply.good)                                    
  44.         {
  45.             BlockMove(reply.fName,fName,sizeof(reply.fName));            
  46.             *vRef = reply.vRefNum;        /* *vref = reply.vRefNum */
  47.             return(TRUE);                                
  48.         }                                                
  49.         return(FALSE);                                    
  50.     }                                    /* End of StdGFile */
  51.     
  52.     /**********     End of File     **********/
  53.